"""
URL configuration for Server project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/4.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, re_path, include

from django.http import FileResponse

urlpatterns = [
    path("admin/", admin.site.urls),
    path("authenticate/", include("rest_framework.urls")),
    # 自定义路由
    # path("attachment/", include("attachment.urls")),  # attachment 提供的路由
    # path(
    #     "attend_situation/", include("attend_situation.urls")
    # ),  # attend_situation 提供的路由
    path("chushi/", include("chushi.urls")),  # chushi 提供的路由
    path("conference/", include("conference.urls")),  # conference 提供的路由
    path("conference_situation/", include("conference_situation.urls")),  # conference 提供的路由
    # path("conference_notice/", include("conference_notice.urls")),  # conference 提供的路由
    path("danwei/", include("danwei.urls")),  # danwei 提供的路由
    path("issue/", include("issue.urls")),  # issue 提供的路由
    path("issue_file/", include("issue_file.urls")),  # issue_file 提供的路由
    path("ro_issue/", include("ro_issue.urls")),  # ro_issue 提供的路由
    path("advice_attend/", include("advice_attend.urls")),  # advice_attend 提供的路由
    # path("material/", include("material.urls")),  # material 提供的路由
    path("person/", include("person.urls")),  # person 提供的路由
    # path("propose/", include("propose.urls")),  # propose 提供的路由
    path("send/", include("send.urls")),  # send 提供的路由
    path("summary/", include("summary.urls")),  # summary 提供的路由
    path("job/", include("job.urls")),  # job 提供的路由
    path("rank/", include("rank.urls")),  # rank 提供的路由
    path("level/", include("level.urls")),  # level 提供的路由
    # 文件上传路由
    path(
        "download/<path:filetype>/<path:filename>",
        lambda request, filetype, filename: FileResponse(
            open(f"download/{filetype}/{filename}", "rb")
        ),
    ),
]
